<?php

/**
 * Created by PhpStorm.
 * User: feng
 * Date: 2017/1/21
 * Time: 下午10:08
 */
class Lyw_jingyan_record_model extends CI_Model
{
    /**
     * type 1 | 2 | ? : 1 为翻译得到的经验 , 2为24小时内无提交
     * is_add 1 | 2 : 1为加,2为减
     */
    public function __construct()
    {
        $this->load->database();
    }

    public function insert($manager_id, $translation_user_id, $jingyan, $is_add)
    {
        $data = array('jingyan' => $jingyan, 'is_add' => $is_add, 'manager_id' => $manager_id, 'user_id' => $translation_user_id, 'creat_time' => time());
        $str = $this->db->insert_string('lyw_jingyan_record', $data);
        $this->db->query($str);
        return $this->db->insert_id();
    }

    public function getInfoByManagerId($manager_id){
        $sql = "select * from lyw_jingyan_record where manager_id = ?";
        $list = $this->db->query($sql , array($manager_id))->result_array();
        return $list;
    }
}